<template>
  <div>
    <div class="div1">
      <van-row>
        <van-col span="8"><router-link to="/index"><van-icon name="arrow-left" />返回首页</router-link></van-col>
        <van-col span="8">设置</van-col>
        <van-col span="8"></van-col>
      </van-row>
    </div>
    <div class="div1">
      <van-image
          radius="20px"
          width="100"
          height="100"
          src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"
      />
      <h4>{{user.name}}</h4>
      <h6>哈哈哈哈哈哈</h6>

    </div>
  </div>
  <div>
    <div class="div1">
      <van-cell-group>
        <van-cell title="通知" icon="volume-o" is-link to="/inform" class="van" />
      </van-cell-group>
      <van-cell-group>
        <van-cell title="粉丝" icon="user-o" is-link  class="van" />
      </van-cell-group>
      <van-cell-group>
        <van-cell title="收藏" icon="like-o" is-link to="/collect"  class="van"/>
      </van-cell-group>

    </div>

    <div class="div1">
      <van-cell-group>
        <van-cell title="帮助" icon="volume-o" is-link  class="van" />
      </van-cell-group>
      <van-cell-group>
        <van-cell title="联系我们" icon="user-o" is-link  class="van" />
      </van-cell-group>

    </div>
    <div class="div2">
      <van-button round size="large" color="#f0ad5e" @click="sendCode()" type="primary">退出登录</van-button>
    </div>

  </div>
</template>

<script>
export default {
  name: "SetView",
  data() {
    return {
      user: {
        id:"",
        phone:"",
        name:"",
        password:"",
        flag:"",
        headportrait: "",
        label:'',
      },
      current:0,
    }
  },mounted() {
    this.add();
  },methods:{
    sendCode() {
      this.axios.get("api/user/loginout.do").then(r=>{
        if (r.data.code == 200) {
          //成功 跳转到首页
          this.$router.push("/login");
        } else {
          this.$toast(r.data.msg);
        }
      })
    },

    add(){
      this.axios.get("api/collect/user.do?").then(r=>{
        if (r.data.code == 200) {
          this.user=r.data.data;

        }else {
        }
      })
    }
  }
}
</script>

<style scoped>
.div1{
  margin-top: 30px;
  margin-bottom: 20px;
}
.div2{
  margin-left: 30px;
  margin-right: 30px;
  margin-top: 30px;
  margin-bottom: 20px;
}
.van{
  margin-left: 10px;
  min-width: 70%;
  text-align: left;
}

</style>